/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2014 abel533@gmail.com
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.talkweb.platform.commonapi.base;

import java.util.List;

import org.springframework.stereotype.Service;

/**
 * 
 * 通用接口
 * 
 * @author  lzy
 * @version  [版本号, 2017年4月26日]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
@Service
public interface IService<T> {

    T selectByKey(Object key);

    int save(T entity);
    
    int batchInsert(List<T> list);

    int deleteByPrimaryKey(Object key);

    int updateAll(T entity);
    
    int batchUpdateAll(List<T> list);

    int updateNotNull(T entity);
    
    int batchUpdateNotNull(List<T> list);

    List<T> selectByExample(Object example);

    /**
     * pageNum=0 并且pageSize=0时，单表查询所有的结果
     * 否则分页查询
     * <功能详细描述>
     * @param entity
     * @param pageNum 
     * @param pageSize
     * @return [参数说明]
     * 
     * @return List<T> [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    List<T> selectAll(T entity,int pageNum,int pageSize);
    
    /**
     * 根据条件删除
     * <功能详细描述>
     * @param key [参数说明]
     * @return void [返回类型说明]
     * @exception throws [违例类型] [违例说明]
     * @see [类、类#方法、类#成员]
     */
    int delete(T entity);
    
    
    List<T> select(T entity,int pageNum,int pageSize);
    
    //TODO 其他...
}
